package com.chensi.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.chensi.model.Classroom;
import com.chensi.model.Student;
import com.chensi.service.IBaseService;

@Controller
@RequestMapping("test")
public class TestController {
	
	@Autowired
	private IBaseService baseService;
	
	@RequestMapping("get")
	@ResponseBody
	public Map<String, Object> get(){
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("data", baseService.get(Student.class, 2));
		return map;
	}
	
	@RequestMapping("getClassroom")
	@ResponseBody
	public Map<String, Object> getClassroom(){
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("data", baseService.get(Classroom.class, 1).getStudents().size());
		return map;
	}
}
